package com.feinno.urcs.group.fxdb;

import com.feinno.database.DataTable;
import com.feinno.database.Database;
import org.helium.framework.annotations.FieldSetter;
import org.helium.framework.annotations.ServiceImplementation;

import java.sql.SQLException;

/**
 * Created by honghao on 7/13/15.
 */
@ServiceImplementation
public class FXPoolServiceImpl implements FXPoolService {

	@FieldSetter(value = "${IICHADB}", loader = HADatabaseLoader.class)
	Database haDb;

	@Override
	public int getPhyicalPool(int logicalPool) throws SQLException {
		String sql = "SELECT PhysicalPoolId FROM CFG_LogicalPool where LogicalPoolId = ?";
		DataTable dt = haDb.executeTable(sql, logicalPool);
		return dt.getRow(0).getInt("PhysicalPoolId");
	}
}
